package com.you.common.util;

import java.util.Iterator;
import java.util.Map;

import com.alibaba.citrus.util.StringEscapeUtil;
import com.alibaba.citrus.util.StringUtil;

public class EscapeUtil {

    public static String escapeBBC(String content, Map<String, String> param) {
        if (content == null || param == null) {
            return null;
        }
        content = StringEscapeUtil.escapeHtml(content);
        Iterator<String> it = param.keySet().iterator();
        while (it.hasNext()) {
            String name = it.next();
            String value = (String) param.get(name);

            content = StringUtil.replace(content, name, "<img src=\"" + value + "\">");
        }
        return content;
    }

}
